import 'package:flutter/material.dart';
import 'package:flutter_vant_ui/flutter_vant_ui.dart';

import '../../demos/demos.dart';

class VanDocDemoButtonSection extends StatelessWidget {
  const VanDocDemoButtonSection({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Button')),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.all(16.0).copyWith(bottom: 40),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              const VanDocDemoBlockTitle(title: "按钮类型", paddingTop: 20, paddingLeft: 0),
              const Wrap(spacing: 20, runSpacing: 8, children: [
                VanButton(text: "主要按钮", type: VanButtonType.primary),
                VanButton(text: "成功按钮", type: VanButtonType.success),
                VanButton(text: "默认按钮", type: VanButtonType.defaults),
                VanButton(text: "危险按钮", type: VanButtonType.danger),
                VanButton(text: "警告按钮", type: VanButtonType.warning),
              ]),
              const VanDocDemoBlockTitle(title: "朴素类型", paddingLeft: 0),
              const Wrap(spacing: 20, runSpacing: 8, children: [
                VanButton(text: "朴素类型", type: VanButtonType.primary, plain: true),
                VanButton(text: "朴素类型", type: VanButtonType.success, plain: true),
              ]),
              const VanDocDemoBlockTitle(title: "细边框", paddingLeft: 0),
              const Wrap(spacing: 20, runSpacing: 8, children: [
                VanButton(text: "细边框按钮", type: VanButtonType.primary, plain: true, hairline: true),
                VanButton(text: "细边框按钮", type: VanButtonType.success, plain: true, hairline: true),
              ]),
              const VanDocDemoBlockTitle(title: "禁用状态", paddingLeft: 0),
              const Wrap(spacing: 20, runSpacing: 8, children: [
                VanButton(text: "禁用状态", type: VanButtonType.primary, disabled: true),
                VanButton(text: "禁用状态", type: VanButtonType.success, disabled: true),
              ]),
              const VanDocDemoBlockTitle(title: "加载状态", paddingLeft: 0),
              const Wrap(spacing: 20, runSpacing: 8, children: [
                VanButton(type: VanButtonType.primary, loading: true),
                VanButton(type: VanButtonType.primary, loading: true, loadingType: VanButtonLoadingType.spinner),
                VanButton(type: VanButtonType.primary, loading: true, loadingText: "加载中..."),
              ]),
              const VanDocDemoBlockTitle(title: "按钮形状", paddingLeft: 0),
              const Wrap(spacing: 20, runSpacing: 8, children: [
                VanButton(text: "方形按钮", type: VanButtonType.primary, square: true),
                VanButton(text: "圆形按钮", type: VanButtonType.success, round: true),
              ]),
              const VanDocDemoBlockTitle(title: "图标形状", paddingLeft: 0),
              const Wrap(spacing: 20, runSpacing: 8, children: [
                VanButton(type: VanButtonType.primary, icon: Icons.add),
                VanButton(text: "按钮", type: VanButtonType.primary, icon: Icons.add),
                VanButton(text: "按钮", type: VanButtonType.success, plain: true, icon: Icons.verified_user),
              ]),
              const VanDocDemoBlockTitle(title: "按钮尺寸", paddingLeft: 0),
              const Wrap(spacing: 8, runSpacing: 8, children: [
                VanButton(text: "大号按钮", type: VanButtonType.primary, size: VanButtonSize.large),
                VanButton(text: "普通按钮", type: VanButtonType.primary, size: VanButtonSize.normal),
                VanButton(text: "小型按钮", type: VanButtonType.primary, size: VanButtonSize.small),
                VanButton(text: "迷你按钮", type: VanButtonType.primary, size: VanButtonSize.mini),
              ]),
              const VanDocDemoBlockTitle(title: "块级元素", paddingLeft: 0),
              const Wrap(spacing: 20, runSpacing: 8, children: [
                VanButton(text: "块级元素", type: VanButtonType.primary, block: true),
              ]),
              const VanDocDemoBlockTitle(title: "页面导航(未实现)", paddingLeft: 0),
              const Wrap(spacing: 20, runSpacing: 8, children: [
                VanButton(text: "URL 跳转", type: VanButtonType.primary),
                VanButton(text: "路由跳转", type: VanButtonType.primary),
              ]),
              const VanDocDemoBlockTitle(title: "自定义颜色", paddingLeft: 0),
              Wrap(spacing: 20, runSpacing: 8, children: [
                VanButton(text: "单色按钮", color: VanBgColor(const Color(0xff7232dd))),
                VanButton(text: "单色按钮", color: VanBgColor(const Color(0xff7232dd)), plain: true),
                VanButton(
                  text: "渐变色按钮",
                  color: VanBgColor(const LinearGradient(
                    colors: [Color(0xffff6034), Color(0xffee0a24)],
                  )),
                ),
              ]),
              const VanDocDemoBlockTitle(title: "动画按钮(未实现)", paddingLeft: 0),
              const Wrap(spacing: 20, runSpacing: 8, children: [
                VanButton(type: VanButtonType.danger, round: true, child: Text("抽大奖或做任务")),
                VanButton(type: VanButtonType.warning, square: true, plain: true, child: Text("抽大奖或做任务")),
              ]),
            ],
          ),
        ),
      ),
    );
  }
}
